/*************************************************************************************************
Script name: convert1.0.0.0_1.0.0.1
Description: 
*************************************************************************************************/

CREATE PROCEDURE [#convert1.0.0.0_1.0.0.1](@Version nvarchar(10)='' OUTPUT)
AS
BEGIN
	DECLARE @ret int, @sqltext nvarchar(4000)

	SET NOCOUNT ON	

	BEGIN TRY
		BEGIN TRANSACTION
/*
		SET @sqltext = N'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'
		EXECUTE @ret = sp_executesql @sqltext
 		
		SET @sqltext = N'IF NOT EXISTS(SELECT * FROM SYS.COLUMNS COL 
					WHERE col.OBJECT_ID = OBJECT_ID(N''UserInfo'') AND COL.NAME = N''LanguageId'')
				BEGIN
					ALTER TABLE dbo.UserInfo ADD [LanguageId] [uniqueidentifier] NULL
					
					ALTER TABLE [dbo].[UserInfo]  WITH CHECK ADD  CONSTRAINT [FK_UserInfo_LanguageId] FOREIGN KEY([LanguageId])
					REFERENCES [dbo].[LookupCode] ([CodeId])
					
					UPDATE dbo.UserInfo SET LanguageId = ''9080808F-3844-4C89-8A2D-339F725E811A''
				END'
		EXECUTE @ret = sp_executesql @sqltext
*/
		COMMIT TRANSACTION
		SET @Version = '1.0.0.1'
	END TRY
	BEGIN CATCH
		SET @Version = '1.0.0.0'
		SET @ret = @@ERROR
		DECLARE @ErrorMessage NVARCHAR(4000),@ErrorSeverity INT,@ErrorState INT
		SELECT
			@ErrorMessage = ERROR_MESSAGE(),
			@ErrorSeverity = ERROR_SEVERITY(),
			@ErrorState = ERROR_STATE()
		IF @ErrorState=0 
			SET @ErrorState = 1
		RAISERROR (@ErrorMessage,@ErrorSeverity,@ErrorState)
		ROLLBACK TRANSACTION
	END CATCH

	SET NOCOUNT OFF

	RETURN @ret
END
GO
